import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Reverse {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        String s = reader.readLine();
        String t = reader.readLine();

        boolean[] hash = new boolean[300];
        for(int i = 0; i < t.length(); i++){
            hash[t.charAt(i)] = true;
        }

        for(int i = 0; i < s.length(); i++){
            if(!hash[s.charAt(i)]){
                System.out.print(s.charAt(i));
            }
        }
    }

    public ListNode FindFirstCommonNode(ListNode pHead1, ListNode pHead2) {

        ListNode cur1 = pHead1, cur2 = pHead2;
        while(cur1 != cur2){
            cur1 = cur1 == null ? pHead2 : cur1.next;
            cur2 = cur2 == null ? pHead1 : cur2.next;
        }
        return cur1;
    }

    public static void main2(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();

        long a = 0, b = 0, c = 0;
        for(int i = 0; i < n; i++){
            char ch = s.charAt(i);
            if(ch == 's'){
                a ++;
            }else if(ch == 'h'){
                b += a;
            }else if(ch == 'y'){
                c += b;
            }
        }
        System.out.println(c);
    }
}
